<template>
  <div>
    <Header></Header>
    <div v-show="loading">正在加载......</div>
    <div class="article_list">
      <ul>
        <li v-for="(item,index) in list" :key="index">
           <time v-text="$utils.goodTime(item.create_at)"></time>
           <router-link :to="'/content/' + item.id">
            {{ item.title }}
           </router-link>
        </li>
      </ul>
    </div>
    <Footer></Footer>
  </div>
</template>

<script>
import Header from '../components/Header.vue'
import Footer from '../components/Footer.vue'
export default {
  components: {
    Header,
    Footer
  },
  data () {
    return {
      loading: true,
      list: []
    }
  },
  created () {
    this.getData()
  },
  methods: {
    getData () {
      this.$api.get('topics', null, r => {
        this.list = r.data
        this.loading = false
        console.log(r)
      })
    }
  }
}
</script>
